/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.edu.agh.io.gpstracker.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author wkedzior
 */
@Entity
@Table(name = "node")
@NamedQueries({
    @NamedQuery(name = "Node.findAll", query = "SELECT n FROM Node n"),
    @NamedQuery(name = "Node.findById", query = "SELECT n FROM Node n WHERE n.id = :id"),
    @NamedQuery(name = "Node.findByLatitude", query = "SELECT n FROM Node n WHERE n.latitude = :latitude"),
    @NamedQuery(name = "Node.findByLongitude", query = "SELECT n FROM Node n WHERE n.longitude = :longitude")})
public class Node implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    
    @Basic(optional = false)
    @Column(name = "latitude")
    private Double latitude;

	@Basic(optional = false)
    @Column(name = "longitude")
    private Double longitude;

	//@Column(name = "seq_time")//
    //private Date seqTime;
	
    /*@OneToMany(cascade = CascadeType.ALL, mappedBy = "node")
    private List<Position> positionList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "node")
    private List<Waysequence> waysequenceList;
    
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "node")
    private List<Areasequence> areasequenceList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "node")
    private List<Places> placesList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "node")
    private List<Tracksequence> tracksequenceList;*/
    public Node() {
    }
    public Node(Long id) {
        this.id = id;
    }

    public Node(Long id, double latitude, double longitude) {
        this.id = id;
        this.latitude = latitude;
        this.longitude = longitude;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Node)) {
            return false;
        }
        Node other = (Node) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

 /*   public List<Areasequence> getAreasequenceList() {
        return areasequenceList;
    }
*/
    public Long getId() {
        return id;
    }

    public Double getLatitude() {
        return latitude;
    }

    public Double getLongitude() {
        return longitude;
    }

   /* public List<Places> getPlacesList() {
        return placesList;
    }

    public List<Position> getPositionList() {
        return positionList;
    }
*/
   /* public Date getSeqTime() {
		return seqTime;
	}
*/
   /* public List<Tracksequence> getTracksequenceList() {
        return tracksequenceList;
    }

    public List<Waysequence> getWaysequenceList() {
        return waysequenceList;
    }*/

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

   /* public void setAreasequenceList(List<Areasequence> areasequenceList) {
        this.areasequenceList = areasequenceList;
    }*/

    public void setId(Long id) {
        this.id = id;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }
/*
    public void setPlacesList(List<Places> placesList) {
        this.placesList = placesList;
    }

    public void setPositionList(List<Position> positionList) {
        this.positionList = positionList;
    }*/

   /* public void setSeqTime(Date seqTime) {
		this.seqTime = seqTime;
	}*/

    /*public void setTracksequenceList(List<Tracksequence> tracksequenceList) {
        this.tracksequenceList = tracksequenceList;
    }

    public void setWaysequenceList(List<Waysequence> waysequenceList) {
        this.waysequenceList = waysequenceList;
    }*/

    @Override
    public String toString() {
        return "pl.edu.agh.io.gpstracker.model.Node[id=" + id + "]";
    }

}
